package com.filetest;

import java.io.File;
import java.io.IOException;

public class fileIO {
    public static void main(String[] args) {
        File f = new File("E:/666.txt");
        if(f.exists()){
            f.delete();
        }else{
            try {
                f.createNewFile();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        System.out.println("文件名称:"+f.getName());
        System.out.println("文件路径:"+f.getPath());
        System.out.println(f.canWrite()?"文件可写":"文件不可写");
        System.out.println(f.isDirectory()?"是目录":"不是目录");
        System.out.println("文件长度:"+f.length()+"Bytes");
    }
}
